{extend name='public/base' /}
{block name='content'}
{include file='public/content_header' /}
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <!-- 表单头部 -->
                <div class="box-header with-border">
                    <div class="btn-group">
                        <a class="btn flat btn-sm btn-default BackButton">
                            <i class="fa fa-arrow-left"></i>
                            返回
                        </a>
                    </div>
                </div>
                <!-- 表单 -->
                <form id="dataForm" class="form-horizontal dataForm" action="" method="post" enctype="multipart/form-data">
                    <!-- 表单字段区域 -->
                    <div class="box-body">
                        <div class="form-group">
                            <label for="task_no" class="col-sm-2 control-label">任务编号</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="task_no" name="task_no" value="{$data.task_no|default=''}" placeholder="请输入任务编号" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="order_id" class="col-sm-2 control-label">主任务id</label>
                            <div class="col-sm-10 col-md-4">
                                <select name="order_id" id="order_id" class="form-control field-select" data-placeholder="请选择主任务id">
                                    <option value=""></option>
                                </select>
                            </div>
                        </div>
                        <script>
                            $('#order_id').select2();
                        </script>
                        <div class="form-group">
                            <label for="uid" class="col-sm-2 control-label">粉丝id</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="uid" name="uid" value="{$data.uid|default='0'}" placeholder="请输入粉丝id" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="image" class="col-sm-2 control-label">二维码</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="image" name="image" value="{$data.image|default=''}" placeholder="请输入二维码" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="url" class="col-sm-2 control-label">任务链接</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="url" name="url" value="{$data.url|default=''}" placeholder="请输入任务链接" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="order_no" class="col-sm-2 control-label">订单编号</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="order_no" name="order_no" value="{$data.order_no|default=''}" placeholder="请输入订单编号" type="text" class="form-control field-text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="pics" class="col-sm-2 control-label">截图列表</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="pics" name="pics"  placeholder="请上传截图列表" data-initial-preview="{$data.pics|default=''}" type="file" class="form-control field-image" >
                            </div>
                        </div>
                        <script>
                            $('#pics').fileinput({
                                language: 'zh',
                                overwriteInitial: true,
                                browseLabel: '浏览',
                                initialPreviewAsData: true,
                                dropZoneEnabled: false,
                                showUpload:false,
                                showRemove: false,
                                allowedFileTypes:['image'],
                                maxFileSize:10240,
                            });
                        </script>
                        <div class="form-group">
                            <label for="video" class="col-sm-2 control-label">视频</label>
                            <div class="col-sm-10 col-md-4">
                                <input id="video" name="video"  placeholder="请上传视频" data-initial-preview="{$data.video|default=''}" type="file" class="form-control field-image" >
                            </div>
                        </div>
                        <script>
                            $('#video').fileinput({
                                language: 'zh',
                                overwriteInitial: true,
                                browseLabel: '浏览',
                                initialPreviewAsData: true,
                                dropZoneEnabled: false,
                                showUpload:false,
                                showRemove: false,
                                allowedFileTypes:['image'],
                                maxFileSize:10240,
                            });
                        </script>
                        <div class="form-group">
                            <label for="comments" class="col-sm-2 control-label">评语</label>
                            <div class="col-sm-10">
                                <script id="comments" name="comments" type="text/plain">{$data.comments|raw|default=''}</script>
                            </div>
                        </div>
                        <script>
                            UE.delEditor('comments');
                            var UE_comments = UE.getEditor('comments',{
                                serverUrl :UEServer
                            });
                        </script>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">
                                状态
                                <!--0 待完成 1进行中 2已完成 -1失效-->
                            </label>
                            <div class="col-sm-10 col-md-4" style="padding:5px;">&nbsp;
                                <input type="radio" name="status" value="0" {if isset($data) && $data.status==0} checked {/if} />&nbsp;待完成&nbsp;
                                <input type="radio" name="status" value="1" {if isset($data) && $data.status==1} checked {/if} />&nbsp;进行中&nbsp;
                                <input type="radio" name="status" value="2" {if isset($data) && $data.status==2} checked {/if} />&nbsp;已完成&nbsp;
                                <input type="radio" name="status" value="-1" {if isset($data) && $data.status==-1} checked {/if} />&nbsp;失效&nbsp;
                            </div>
                        </div>

                    </div>
                    <!-- 表单底部 -->
                    <div class="box-footer">
                        {:token()}
                        <div class="col-sm-2">
                        </div>
                        <div class="col-sm-10 col-md-4">
                            {if !isset($data)}
                            <div class="btn-group pull-right">
                                <label class="createContinue">
                                    <input type="checkbox" value="1" id="_create" name="_create"
                                           title="继续添加数据">继续添加</label>
                            </div>
                            {/if}
                            <div class="btn-group">
                                <button type="submit" class="btn flat btn-info dataFormSubmit">
                                    保存
                                </button>
                            </div>
                            <div class="btn-group">
                                <button type="reset" class="btn flat btn-default dataFormReset">
                                    重置
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</section>
<script>
    /** 表单验证 **/
    $('#dataForm').validate({
        rules: {
            'task_no': {
                required: true,
            },
            'order_id': {
                required: true,
            },
            'uid': {
                required: true,
            },
            'image': {
                required: true,
            },
            'url': {
                required: true,
            },
            'order_no': {
                required: true,
            },
            'comments': {
                required: true,
            },

        },
        messages: {
            'task_no': {
                required: "任务编号不能为空",
            },
            'order_id': {
                required: "主任务id不能为空",
            },
            'uid': {
                required: "粉丝id不能为空",
            },
            'image': {
                required: "二维码不能为空",
            },
            'url': {
                required: "任务链接不能为空",
            },
            'order_no': {
                required: "订单编号不能为空",
            },
            'comments': {
                required: "评语不能为空",
            },

        }
    });
</script>
{/block}